#!/bin/dash

max=$(cat /sys/class/backlight/intel_backlight/max_brightness)
if [ $1 = "max" ]; then
    echo $max
    exit 1
fi

valid=$(echo "$1<=$max" | bc)
if [ $(($valid)) -eq 1 ]; then
    echo $1 | tee /sys/class/backlight/intel_backlight/brightness
else
    echo "max $max"
fi
